import java.util.Random;

public class Test {
    public static void main(String[] args) {
        Random random=new Random();
        int[]arr={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
        for (int i = 0; i <arr.length ; i++) {
            int index=random.nextInt(arr.length);
            int temp=arr[index];
            arr[index]=arr[i];
            arr[i]=temp;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }

        int [][]arr1=new int [4][4];

        for(int i=0;i< arr.length;i++){
            arr1[i/4][i%4]=arr[i];
        }

        for (int i = 0; i <4 ; i++) {
            for(int j=0;j< arr1[i].length;j++){
                System.out.print(arr1[i][j]+" ");
            }
            System.out.println("");
        }
    }
}
